/**
 * Recursively makes all properties of a type required and removes undefined from union types.
 * - Processes properties using mapped types and conditional types.
 * - Excludes undefined from property types, including nested objects.
 */
export type DeepRequiredWithoutUndefined<T> = {
  [K in keyof T]-?: T[K] extends object
    ? DeepRequiredWithoutUndefined<Exclude<T[K], undefined>>
    : Exclude<T[K], undefined>;
} extends infer O
  ? { [K in keyof O]: O[K] }
  : never;
